﻿using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zhaoxi.SerilogSample.IOCLog
{
    public class TestLog
    {
        private readonly ILogger _logger;

        public TestLog(ILogger<TestLog> logger)
        {
            _logger = logger;
        }

        public void Show()
        {
            var leveles = (LogLevel[])Enum.GetValues(typeof(LogLevel)); // 获取日志级别
            var eventId = 1;
            foreach (var level in leveles) // 遍历日志级别
            {
                _logger.Log(level, eventId++, $"这是一条{level}消息");
                //logger.Log(level, $"这是一条{level}消息");
            }
        }
    }
}
